Creating good graphics

RASP III

Matthew Shane Loop, PhD

2022-01-19

Class polls

We will use multiple polls throughout this class. Just go to pollev.com/matthewloop821 when it’s time to conduct a poll.

Learning objectives

  1. State the purpose of a graph.
  2. Pick the right type of plot for the type of data you have.

Primary purpose of a graph

There are ways of making a graph that slow a reader down.

What is the fourth most common suggested edit?

What company had the 4th highest revenue in 2010?

There are ways of making a graph that distort how accurately you view the relationships.

How many percentage points higher is those with an A and 60-90% attendance vs. those with a D and <60% attendance?

Pick the right type of plot for the type of data you have

For this section, we will switch between the gapminder dataset, which contains information such as gross domestic product, life expectancy, and fertility on as many countries as possible from 1960 to 2016, and the Framingham Heart Study dataset, the first major cohort study on heart disease started in 1948.

Univariate graphs

Continuous variables

Histogram:

Density plot:

Categorical variables

Bivariate graphs

Two categorical variables

One categorical, one continuous variable

Continuous plots, but by color for categorical variable:

Summaries of continuous variable, by categorical variable:

Two continuous variables

Two continuous variables, grouped by a third variable

All graphs basically show one or two variables and how they vary according to a third variable.

The fundamental analytical act in statistical reasoning is to answer the question “Compared with what?”1 Edward Tufte, Beautiful Evidence, p. 127